package tjs.study.notes.dotest.jvm.heap;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
 * Created by Nicky.Tang on 2021/10/13 5:13 下午
 *
 * @since 02.12.10
 */
public class 分析DUMP {


    /**
     * 1. JVM设置    
     * -Xms10M -Xmx10M -XX:+PrintGCDetails -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/Users/piangpiang/Documents/my-workspace/my-mayun/tjs-study-notes-test2/tjs-study-notes/tjs-study-notes/tjs-study-dotest/src/main/java/tjs/study/notes/dotest/jvm/heap/jvm.dump
     * -XX:+PrintGCDetails 打印gc时堆的情况
     * -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath= 转存gc时内存情况
     * 1.1 也可以先查出pid，然后再导出
     * jmap -dump:format=b,file=xxxx.dump 97016（97016为pid,xxxx.dump为目标文件）
     *
     *
     * 2.打开dump可视化分析工具
     * jvisualvm
     */
    public static void main(String[] args) throws InterruptedException {
        List<Object> list = new ArrayList<>();
        int i = 0;
        for (; i < 10000; i++) {
            list.add(new UserJvm(i++, UUID.randomUUID().toString()));
        }
        System.gc();
    }

}
